﻿#region License
/* ---------------------------------------------------------------- *
 *
 * This file is part of the Xcoordination Application Space
 * ("XcoAppSpace") http://www.xcoordination.com
 *
 * Copyright (C) 2009 Xcoordination http://www.xcoordination.com
 *
 * XcoAppSpace is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General
 * Public License as published by the Free Software Foundation.
 *
 * XcoAppSpace is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/
 * or write to the Free Software Foundation, Inc., 51 Franklin
 * Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * ---------------------------------------------------------------- */
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using XcoAppSpaces.Contracts.Service;


namespace XcoAppSpaces.Core.Configuration
{
	/// <summary>
	/// Defines the service implementations and config string interpreters that are used by default.
	/// </summary>
	public static class DefaultInterpreters
	{
		public static readonly List<Type> CustomConfigStringInterpreterTypes = new List<Type>();

		public static Func<IEnumerable<IXcoConfigStringInterpreter>> GetDefaultConfigStringInterpreters =
			() => new IXcoConfigStringInterpreter[] {};

//		public static IEnumerable<IXcoConfigStringInterpreter> DefaultConfigStringInterpreters
//		{
//			get
//			{
//				return new List<IXcoConfigStringInterpreter>
//						{
//							new XcoAppSpaces.Transport.Sockets.ConfigStringInterpreter(),
//#if !PocketPC && !SILVERLIGHT
//							new XcoAppSpaces.Core.Configuration.Interpreters.SerializerConfigStringInterpreter(),
//							new XcoAppSpaces.Transport.WCF.ConfigStringInterpreter(),
//							new XcoAppSpaces.Transport.Jabber.ConfigStringInterpreter(),
//							new XcoAppSpaces.Transport.MSMQ.ConfigStringInterpreter(),
//							new XcoAppSpaces.Security.Basic.ConfigStringInterpreter(),
//#endif
//						};
//			}
//		}

		public static IEnumerable<IXcoConfigStringInterpreter> ConfigStringInterpreters
		{
			get { return GetDefaultConfigStringInterpreters().Union(CustomConfigStringInterpreterTypes.Select(t => (IXcoConfigStringInterpreter)Activator.CreateInstance(t))); }
		}
	}
}
